﻿/****************************** Module Header ******************************\
* Module Name:	Program.cs
* Project:		CSConsoleThrowException
* Copyright (c) Microsoft Corporation.
* 
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
* All other rights reserved.
* 
* History:
* * 1/31/2009 3:06 PM Jialiang Ge Created
\***************************************************************************/

#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion


namespace CSConsoleThrowException
{
    /// <summary>
    /// Program
    /// </summary>
    class Program
    {
        /// <summary>
        /// Main
        /// </summary>
        static void Main(string[] args)
        {
            // Throw the exception System.DivideByZeroException
            {
                Console.WriteLine(
                    "Throw the exception: System.DivideByZeroException");
                int i = 0, j = 0;
                i = i / j;
            }

            // Throw a user-defined exception 
            {
                Console.WriteLine(
                    "Throw a user-defined exception: UserDefinedException");
                throw new UserDefinedException();
            }

        } // Main(args)
    } // class Program

    /// <summary>
    /// User defined exception
    /// </summary>
    class UserDefinedException : Exception
    {
    } // class UserDefinedException

} // namespace CSConsoleThrowException
